package com.lovedice;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class Dice extends TabActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dice);

		Resources res = getResources(); // Resource object to get Drawables
        TabHost tabHost = getTabHost();  // The activity TabHost
        TabHost.TabSpec spec;  // Resusable TabSpec for each tab
        Intent intent;  // Reusable Intent for each tab

        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, DiceAction.class);

        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec(res.getString(R.string.dices_tab_action))
        				.setIndicator(res.getString(R.string.dices_tab_actions), res.getDrawable(R.drawable.tab_dice_action_active))
        				.setContent(intent);
        tabHost.addTab(spec);

        // Do the same for the other tabs
        intent = new Intent().setClass(this, DiceBody.class);
        spec = tabHost.newTabSpec(res.getString(R.string.dices_tab_body))
			.setIndicator(res.getString(R.string.dices_tab_bodys), res.getDrawable(R.drawable.tab_dice_body_active))
			.setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, DiceBonus.class);
        spec = tabHost.newTabSpec(res.getString(R.string.dices_tab_bonus))
			.setIndicator(res.getString(R.string.dices_tab_bonuses), res.getDrawable(R.drawable.tab_dice_bonus_active))
			.setContent(intent);
        tabHost.addTab(spec);

        tabHost.setCurrentTab(0);
    }
}
